﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Nest;

namespace ElasticSearchDemo.Models
{
    [ElasticsearchType(RelationName = "employee", IdProperty = "Id")]
    public class Product
    {
        /// <summary>
        /// Id
        /// </summary>
        [Number(NumberType.Long, Name = "id")]
        public long Id { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        [Text(Name = "product_name", Analyzer = "ik_max_word", SearchAnalyzer = "ik_max_word")]
        public string ProductName { get; set; }

        /// <summary>
        ///  店铺
        /// </summary>
        [Text(Name="shop_name",Analyzer ="ik_max_word",SearchAnalyzer ="ik_smart")]
        public string ShopName { get; set; }

        /// <summary>
        /// 价格
        /// </summary>
        [Number(NumberType.Double,Name="price")]
        public decimal Price { get; set; }

        /// <summary>
        /// 图片地址
        /// </summary>
        [Keyword(Name="img")]
        public string Img { get; set; }


        /// <summary>
        /// 人气
        /// </summary>
        [Number(NumberType.Integer,Name="popularity")]
        public int Popularity { get; set; }

        /// <summary>
        /// 是否新品
        /// </summary>
        /// 
        [Boolean(Name="is_new")]
        public bool IsNew { get; set; }

        /// <summary>
        /// 销量
        /// </summary>
        [Number(NumberType.Integer,Name="sales")]
        public int Sales { get; set; }

        /// <summary>
        /// 评价
        /// </summary>
        [Number(NumberType.Integer,Name="evaluate")]
        public int Evaluate { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Date(Name="create_time")]
        public DateTime CreateTime { get; set; }


        [Ignore]
        public string test1 { get; set; }


        [Ignore]
        public string test2 { get; set; }

        
        
        
    }
}
